// JavaScript Document
$(function() {
	$(".time  .timeBtn").click(function() {// 时间
		if (!$(this).hasClass("yes")) {
			
			$(".time  .timeBtn.yes").removeClass("yes");
			$(this).addClass("yes");
			if ($(this).attr("data-time") != null) {
				$("#selectButton").val($(this).attr("data-time"));
				setQtime(parseInt($(this).attr("data-time")));// 设置日区间时间
			}
		}
	});
	var setQtime=function(a) {// 日期设置
		var oDate = new Date();
		// var vdate=addDate(oDate,a*-1);
		// $("#date_2").val(addDate(oDate,0));
		// $("#date_1").val(addDate(oDate,a*-1));
		var s = addDate(oDate, 0);
		var e = addDate(oDate, a * -1);
		$("#startTime").val(e);
		$("#endTime").val(s);
		$("#dtp_input2").val(addDate(oDate, 0));
		$("#dtp_input1").val(addDate(oDate, a * -1));
		$("#submit").click();
		//statistics(addDate(oDate, 0), addDate(oDate, a * -1));
	};
	var addDate=function(date, days) {// 日期返回
		var d = new Date(date);
		d.setDate(d.getDate() + days);
		var month = d.getMonth() + 1;
		var day = d.getDate();
		if (month < 10) {
			month = "0" + month;
		}
		if (day < 10) {
			day = "0" + day;
		}
		var val = d.getFullYear() + "-" + month + "-" + day;
		return val;
	};

});
